// 京东
function getCookie(name) {
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
	if (arr = document.cookie.match(reg)) {
		return unescape(arr[2])
	} else {
		return ''
	}
}
function changeStr(allstr, start, end, changeStr) {
	return allstr.substring(0, start - 1) + changeStr + allstr.substring(end, allstr.length)
}
var this_url = window.location.href;
var zdm_track_info = getCookie("zdm_track_info");
if (zdm_track_info != '') {
	zdm_track_info = eval("(" + zdm_track_info + ")");
	source = zdm_track_info.source;
	channel = zdm_track_info.channel;
	if (this_url.indexOf(source + "/" + channel) < 0) {
		go_url = changeStr(this_url, 26, 30, source + "/" + channel);
		window.location.replace = go_url
	}
}(function() {
	(function(i, s, o, g, r, a, m) {
		i['GoogleAnalyticsObject'] = r;
		i[r] = i[r] ||
		function() {
			(i[r].q = i[r].q || []).push(arguments)
		}, i[r].l = 1 * new Date();
		a = s.createElement(o), m = s.getElementsByTagName(o)[0];
		a.async = 1;
		a.src = g;
		m.parentNode.insertBefore(a, m)
	})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
	var cookie_user = getCookie('user');
	var arr = cookie_user.split('|');
	if (arr[1]) {
		ga('create', 'UA-27058866-1', 'auto', {
			'userId': arr[1]
		})
	} else {
		ga('create', 'UA-27058866-1', 'auto')
	}
	var redirected = false;
	var is_amazon = false;

	function redirect() {
		if (redirected) return;
		redirected = true;
		if (is_amazon) {
			var ifr = document.createElement('iframe');
			ifr.src = smzdmhref1;
			ifr.style.display = 'none';
			document.body.appendChild(ifr);
			window.setTimeout(function() {
				document.body.removeChild(ifr);
				window.location.href = smzdmhref
			}, 1000)
		} else {
			window.location.href = smzdmhref
		}
	}
	ga('set', 'page', location.href);
	ga('send', 'pageview');
	smzdmhref = 'https://www.linkstars.com/click.php?feedback=156_0_184__ca_aa_fx_1515_0&to=https%3A%2F%2Fitem.jd.com%2F4432407.html';
	var uaStr = navigator.userAgent.toLowerCase();
	if (uaStr.indexOf('chrome/53') > 0 || uaStr.indexOf('chrome/54') > 0) {
		smzdmhref = smzdmhref.replace('https://www.linkstars.com', 'http://www.linkstars.com')
	}
	smzdmhref1 = 'https://www.linkstars.com/click.php?feedback=156_0_184__ca_aa_fx_1515_0&to=https%3A%2F%2Fitem.jd.com%2F4432407.html';
	ga('send', 'event', '直达链接', 'ca', 'fx', {
		'dimension29': 'aa',
		'dimension6': '1515',
		'dimension1': '0',
		'dimension30': 'jd.com',
		'hitCallback': redirect
	});
	setTimeout(redirect, 1000)
})()


//亚马逊
function getCookie(name) {
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
	if (arr = document.cookie.match(reg)) {
		return unescape(arr[2])
	} else {
		return ''
	}
}
function changeStr(allstr, start, end, changeStr) {
	return allstr.substring(0, start - 1) + changeStr + allstr.substring(end, allstr.length)
}
var this_url = window.location.href;
var zdm_track_info = getCookie("zdm_track_info");
if (zdm_track_info != '') {
	zdm_track_info = eval("(" + zdm_track_info + ")");
	source = zdm_track_info.source;
	channel = zdm_track_info.channel;
	if (this_url.indexOf(source + "/" + channel) < 0) {
		go_url = changeStr(this_url, 26, 30, source + "/" + channel);
		window.location.replace = go_url
	}
}(function() {
	(function(i, s, o, g, r, a, m) {
		i['GoogleAnalyticsObject'] = r;
		i[r] = i[r] ||
		function() {
			(i[r].q = i[r].q || []).push(arguments)
		}, i[r].l = 1 * new Date();
		a = s.createElement(o), m = s.getElementsByTagName(o)[0];
		a.async = 1;
		a.src = g;
		m.parentNode.insertBefore(a, m)
	})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
	var cookie_user = getCookie('user');
	var arr = cookie_user.split('|');
	if (arr[1]) {
		ga('create', 'UA-27058866-1', 'auto', {
			'userId': arr[1]
		})
	} else {
		ga('create', 'UA-27058866-1', 'auto')
	}
	var redirected = false;
	var is_amazon = false;

	function redirect() {
		if (redirected) return;
		redirected = true;
		if (is_amazon) {
			var ifr = document.createElement('iframe');
			ifr.src = smzdmhref1;
			ifr.style.display = 'none';
			document.body.appendChild(ifr);
			window.setTimeout(function() {
				document.body.removeChild(ifr);
				window.location.href = smzdmhref
			}, 1000)
		} else {
			window.location.href = smzdmhref
		}
	}
	ga('set', 'page', location.href);
	ga('send', 'pageview');
	smzdmhref = 'https://www.amazon.cn/dp/B005IFCE74?t=ca_fx_57-23&tag=ca_fx_57-23';
	var uaStr = navigator.userAgent.toLowerCase();
	if (uaStr.indexOf('chrome/53') > 0 || uaStr.indexOf('chrome/54') > 0) {
		smzdmhref = smzdmhref.replace('https://www.linkstars.com', 'http://www.linkstars.com')
	}
	smzdmhref1 = 'https://www.amazon.cn/dp/B005IFCE74?t=ca_fx_57-23&tag=ca_fx_57-23';
	ga('send', 'event', '直达链接', 'ca', 'fx', {
		'dimension29': 'aa',
		'dimension6': '57',
		'dimension1': '895',
		'dimension30': 'amazon.cn',
		'hitCallback': redirect
	});
	setTimeout(redirect, 1000)
})()
